﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
  public class Complex 
  {
    public Complex(int real, int imag) 
    {
      this.real = real;
      this.imag = imag;//X
    }
    
    private int real;
    private int imag;

    public static Complex operator +(Complex c1, Complex c2) 
    {
      Complex c3 = new Complex(c1.real + c2.real, c1.imag + c2.imag);

      return c3;
    }

    public static Complex operator ++(Complex c1) 
    {
      Complex newComplex = new Complex(c1.real + 1, c1.imag + 1);

      return newComplex;
    }

    //true
    public static bool operator ==(Complex c1, Complex c2) 
    {
      return ((c1.real == c2.real) && (c1.imag == c2.imag));
    }
    
    //false
    public static bool operator !=(Complex c1, Complex c2)
    {
      return ((c1.real != c2.real) || (c1.imag != c2.imag));
    }

    #region Object methods Overriding

    public override string ToString()
    {
      return string.Format("({0}+{1}X)",this.real,this.imag);
    }

    //public override bool Equals(object obj)
    //{
    //  return base.Equals(obj);
    //}

    public override bool Equals(object obj)
    {
      Complex c2 = (Complex)obj;
      return ((this.real == c2.real) && (this.imag == c2.imag));
    }

    public override int GetHashCode()
    {
      return base.GetHashCode();
    }
    #endregion


  }

  class Program
  {
    static void Main(string[] args)
    {


      Complex c1 = new Complex(1, 5);

      Complex c2 = new Complex(1, 5);

      //Complex.Add( c1.GetNumber+c2.GerNunber)
      
      //c1.GetHashCode();

      if (c1.Equals(c2)) 
      {
        Console.WriteLine("True!");
      }
      else 
      {
        Console.WriteLine("False!");
      }
      

    }
  }
}
